<template>
  <div>
    <!-- 资讯页 -->
    <Header/>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
      
      <bottomBar/>
  </div>
</template>

<script>
import Header from '../components/news/header.vue'
import bottomBar from '../components/bottomBar.vue'
export default {
  components:{
    Header,bottomBar
  },
  created(){
    this.$store.dispatch("getnews","/mock/data/newsinfo")
    window.addEventListener("beforeunload", () => {
      localStorage.setItem("stateInfo", JSON.stringify(this.$store.state));
    });
    if (localStorage.getItem("stateInfo")) {
      this.$store.replaceState(
        Object.assign(
          {},
          this.$store.state,
          JSON.parse(localStorage.getItem("stateInfo"))
        )
      );
    }
  }
}
</script>

<style scoped>
a{
  font-size:0.2rem
}
</style>